Bitwise is a versatile and easy to use calculator with many unique features. It was specifically designed for programmers of personal computers and microprocessors. Some of Bitwise' key features include:
• Reverse Polish Notation (RPN) Operating Logic
• Integer arithmetic in Hexadecimal, Decimal, Octal, and Binary
• Number Base Conversions
• Word Sizes of 8, 16, and 32 bits
• Backspace Key Easily Corrects Input Errors
• Optional Byte/Nibble Marks & Leading Zeros
• Unique Pop-Up Stack Register Display with Register Selection
• Logical Operators and Bit Manipulations
• Carry & Overflow Flags
• Full support of Cut, Copy, and Paste to and from the Clipboard
• Continuous Memory
Bitwise is being distributed as shareware. This means you are permitted to use it on a trial basis for up to 30 days. If you continue using Bitwise beyond that period, you are expected to register your copy. Please mail your shareware payment of $10 (US funds only), along with your name & address to:
Eric Curtis
Bitwise Registration
5709 Windlestraw Drive, #25
Durham, NC 27713 U.S.A.
Once you register your copy of Bitwise, you are entitled to use future versions at no additional cost.
INSTALLATION
Since Bitwise is an application, it can be installed virtually anywhere on your Macintosh hard drive or floppy disk. Simply drag the Bitwise application to the destination disk or folder. If you are running System 7 or above, you may want to install Bitwise in the “Apple Menu Items” folder within the System Folder for convenient access from any program.
REVERSE POLISH NOTATION
Bitwise uses an operating logic called Reverse Polish Notation (RPN). If you are already familiar with RPN, you may want to skip ahead to the section titled USING BITWISE.
RPN allows you to perform complex calculations without the need for parentheses or storing & recalling intermediate values. Instead, calculations are performed using a memory “stack”.
To perform a calculation, simply key in the first number, press the ENTER key, key in the second number, and finally press the desired operator key. For example:
First, set the number base to 10 and clear the display by pressing the DEC & BSP keys. (Note: All examples in this manual are in base 10 unless otherwise noted.)
The ENTER key is used to separate two numbers that are keyed in one after the other. However, calculations can also be performed using values already present in the display. For example:
Note that in the preceding example the ENTER key was not needed. This is because in both calculations the first numbers (1224 and 6120) were already in the display.
USING BITWISE
The Memory Stack: The stack consists of four memory registers, referred to as X, Y, Z, and T. The number in the X register is always shown in the calculator's display. The registers are “stacked”, one on top of the other, starting with the X register at the bottom. The Y register appears on top of the X register, the Z register appears on top of the Y register, and finally the T register appears on top of the Z register, at the top of the stack.
Stack Lift and Stack Drop: Bitwise performs calculations by manipulating numbers on the memory stack. Some operations cause the stack to be “lifted”. For example:
If the X register contains 2 and the Y register contains 1, keying in 3 causes the following to occur. The value in T gets pushed off the top of the stack and is lost. The value in Z gets copied to T, the value in Y gets copied to Z, the value in X gets copied to Y, and finally the value 3 replaces the original value in X.
Other operations cause the stack to be “dropped”. For example:
If the X register contains 4 and the Y register contains 5, pressing + causes the value in X to be added to the value in Y and the result replaces the original value in X. Furthermore, the value in Z gets copied to Y and the value in T gets copied to Z, thus completing the stack drop.
Also note that the value in T was regenerated when the stack dropped. This allows it to be used as a constant in repetitive calculations.
Clearing the Display: If digit entry is active (meaning that pressing a digit key doesn’t start a new number), pressing the BSP key deletes the last digit entered. If digit entry has been terminated, pressing BSP clears the X register to zero. Pressing ENTER and most other function keys terminates digit entry; this means the next digit keyed in becomes part of a new number.
Holding down the option key while pressing BSP clears the X register to zero regardless of whether digit entry is active or not. The X register can also be cleared at any time by selecting Clear from the Edit Menu.
More Complex Calculations: The RPN operating logic makes it easy to perform complex calculations without the need for parentheses or storing & recalling intermediate values. For example:
BITWISE KEYS
This section describes the function of each key on the Bitwise keypad. Refer to the following figure.
Hex, Dec, Oct, Bin: These keys select the number base (hexadecimal, decimal, octal, or binary) in which the calculator’s stack registers are displayed. Pressing one of these keys at any time terminates digit input and converts all registers to the selected number base. The current number base is indicated in the status area below the X register display.
0 thru 9, A thru F: These keys are used for digit entry. The valid range of digits is determined by the selected number base. Attempting to enter a digit greater than that allowed in the current number base results in a warning sound. Digits can also be entered from the keyboard and numeric keypad.
+, -, x, ÷, RMD: These keys perform arithmetic operations (addition, subtraction, multiplication, division, and remainder) using the values in the X and Y registers. The stack is dropped after performing any of these operations and the result is placed in the X register. The +, -, x, and ÷ operations set or clear the Carry and Overflow flags based on the result of the calculation. (Note: In division, if the remainder is not zero, the Carry flag is set; otherwise the flag is cleared.) The RMD operation always clears the Carry and Overflow flags. These operations can also be performed from the keyboard by pressing the +, -, *, /, and % keys.
ENTER: When the ENTER key is pressed, digit entry is terminated and the stack is lifted. This operation can also be performed from the keyboard by pressing the return or enter key.
BSP: The BSP key is used to make corrections to a number being entered while digit entry is active. Holding down the option key while pressing the BSP key clears the X register to zero. If digit entry has been terminated, pressing the BSP key alone clears the X register to zero. These operations can also be performed from the keyboard by pressing the delete or option delete keys.
X><Y: The X><Y key exchanges the values in the X and Y registers. This operation can also be performed from the keyboard by pressing the tab key.
1’S: The 1’S key performs a ones complement operation on the value in the X register. This operation can also be performed from the keyboard by pressing the ~ key.
AND, OR, XOR: These keys perform bitwise operations (AND, OR, and Exclusive OR) using the values in the X and Y registers. The stack is dropped after performing any of these operations and the result is placed in the X register. These operations can also be performed from the keyboard by pressing the &, |, and ^ keys.
SL, SR: These keys perform shift-left and shift-right operations (shifting left or right by one bit) on the value in the X register. If a 1 is shifted out of either the left or right side of the word the Carry flag is set. If a 0 is shifted out of either side the Carry flag is cleared. These operations can also be performed from the keyboard by pressing the < and > keys.
BITWISE CALCULATOR MENU
This section describes the function of each menu item in the Calculator menu. Refer to the following figure.
Roll Down Stack: This menu item rolls down the stack registers. (i.e. the value in the Y register gets copied to the X register, the Z register gets copied to the Y register, the T register gets copied to the Z register, and finally the original X register value gets copied to the T register). Rolling down the stack terminates digit input.
Clear Flags: This menu item clears the Carry and Overflow flags. If the Carry or Overflow flag is set, this item is enabled. Otherwise, it is disabled. The current states of the Carry and Overflow flags are indicated in the status area below the X register display.
Word Size: This menu item sets the calculator’s computational word size to 32 bits, 16 bits, or 8 bits (i.e. 4 bytes, 2 bytes, or 1 byte). This is useful when working with microprocessors that use these sizes in their address and data registers. Changing the word size does not terminate digit input. However, any values that are currently in the stack registers may be invalidated (due to truncation) by changing the word size. Attempting to enter a number greater than that allowed in the current word size results in a warning sound. The current word size is indicated in the status area below the X register display.
Byte/Nibble Marks: This menu item toggles on and off the byte and nibble marks when the calculator’s number base is set to Binary. In any other number base this item is disabled.
Leading Zeros: This menu item toggles on and off the display of leading zeros when the calculator’s number base is set to Hexadecimal, Octal, or Binary. In the Decimal number base this item is disabled. The number of leading zeros displayed is dependent on the current word size and number base.
Hexadecimal, Decimal, Octal, Binary: These menu items select the number base in which the calculator’s registers are displayed. These items are equivalent to the Hex, Dec, Oct, and Bin keys on the calculator’s keypad.
POPUP STACK REGISTER DISPLAY
Clicking and holding the mouse pointer anywhere in the calculator’s display pops up the Stack Register display window. This window shows the current values in each of the four stack registers. The X register is at the bottom, topped by the Y, Z, and T registers. In the figure above, the X register contains 106A, Y register contains 35EBC, Z register contains 0, and T register contains 1133D. All values are shown in the current number base (in this case, hexadecimal).
Moving the mouse pointer up and down highlights each stack register as the pointer moves over it. Releasing the mouse button when a particular value is highlighted hides the pop-up window and rolls down the stack making the selected value the new X register.
HIDING THE KEYPAD
Clicking in the zoom box on the right of the calculator’s title bar collapses the calculator’s window to just the size of the display. This saves screen space on computers with small monitors. All of the calculator’s functions can still be performed from the keyboard and numeric keypad. Clicking in the zoom box again restores the calculator to its full size.
THE OTHER MENUS
Apple Menu: Selecting About Bitwise… shows the version number, author, and a brief list of keyboard equivalents.
File Menu: Selecting Quit saves all Registers, Modes, and Window Position on the desktop (including which screen it’s on), then exits the application.
Edit Menu: Bitwise supports the Cut, Copy, Paste, and Clear items of the standard Edit menu. Bitwise can exchange values (from the X register only; in any of the four number bases) with other applications that support data exchange via the clipboard. Only text can be pasted into Bitwise. Attempting to paste anything else from the clipboard results in a warning sound and all stack registers remain unchanged. Selecting the Clear item clears the X register to zero whether digit entry is active or not.
SUMMARY OF BITWISE FEATURES
• RPN Operating Logic
• Continuous Memory of all Registers, Modes, and Window Position on Desktop
• Instant conversion between Hexadecimal, Decimal, Octal, and Binary
• Choose from Word Sizes of 8, 16, and 32 bits
• Backspace key corrects input errors without retyping entire number
• Optional Byte/Nibble Marks in Binary mode
• Optional Leading Zeros in Hexadecimal, Octal, and Binary modes
• Unique Pop-Up Stack Register Display with Register Selection
• Carry & Overflow Flags
• Add, Subtract, Multiply, Divide, and Remainder
• AND, OR, XOR, 1’S Complement, Shift Left & Shift Right
• X Y Register Exchange key
• Stack Roll Down
• Full support of Cut, Copy, and Paste to and from the Clipboard
• Display provides quick indication of Flags, Word Size, and Number Base
• Calculator's keypad can be hidden to save screen space while all functions are still available via the keyboard and numeric keypad
• Keyboard Equivalents for all calculator functions
• Works with Multiple Monitors
• 32-Bit Clean and works with Virtual Memory
• Occupies about 28K of disk space and requires only 64K of RAM
• Works with System 6.0.5 and above, including System 7
ACKNOWLEDGMENTS
I'd like to thank my good friend Herb Winters up in New Hampshire. My original intent was to develop a simple calculator specifically aimed at the needs of programmers. As a result of Herb's encouragement and testing, Bitwise turned out to be even better than I expected.
CONTACTING THE AUTHOR
Please mail your comments, suggestions, and bug reports to:
Eric Curtis
5709 Windlestraw Drive, #25
Durham, NC 27713 U.S.A.
or email them to:
America Online: Boston84
Internet: boston84@aol.com
DISTRIBUTION
Since Bitwise is shareware, you are encouraged to copy and distribute Bitwise for non-commercial use. Bitwise may be distributed via local & national BBSs, user groups, and online services such as America Online, CompuServe, and GEnie. The Bitwise Manual (i.e. this document you are presently reading) must accompany all copies for distribution. You may not modify the Bitwise application or documentation in any way.
All other organizations, including (but not limited to) commercial disk vendors of shareware & public domain software, must obtain written permission from Eric Curtis to distribute copies of Bitwise if any fee is charged for the use, copying, or distribution of this product.
COPYRIGHT
This manual and the software described in it are copyrighted with all rights reserved. Under the copyright laws, this manual or the software my not be copied, in whole or in part, without written permission from Eric Curtis, except in the normal use of the software or to make a backup copy. The same proprietary and copyright notices must be affixed to any permitted copies as were affixed to the original. Under the law, copying includes translating into another language or format.
DISCLAIMER OF WARRANTY AND LIABILITY
Bitwise is supplied as is. Eric Curtis makes no warranty, express or implied, with respect to the software or documentation including implied warranties of merchantability and fitness for a particular purpose.
In no event shall Eric Curtis, or anyone else who has been involved in the creation, testing, production, delivery, or support of the software or this documentation, be liable for any direct, indirect, special, incidental, or consequential damages arising from the use, the results of use, or the inability to use the software or documentation, even if advised of the possibility of such damages.
CREDITS
Macintosh® is a registered trademark of Apple Computer, Inc. Other brands and their products are trademarks or registered trademarks of their respective companies and should be noted as such.